// Problem: 
// Contest: 
// URL: 
// Memory Limit: 
// Time Limit: 
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define pre(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)
//const int N,mod;
inline int read(){
	int s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
	return s*w;
}
void solve()
{
	int n;
	cin>>n;
	vector<int> v(n+1);
	unordered_map<int,int> m;
	int s=0,b=0;
	rep(i,1,n)
	{
		cin>>v[i];
		if(++m[v[i]]==2)s++;
		else if(m[v[i]]>2)b++;
	}
	int x=n-s*2-b;
	int ans;
	if(b>=x)ans=b;
	else ans=b+(x-b)/2;
	cout<<ans<<endl;
	
}
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int T=1;
//	cin>>T;
	while(T--)
	{
		solve();
	}
	return 0;
}
